package cn.itcast.mobilebrowser.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

import java.util.List;

import cn.itcast.mobilebrowser.model.BookMark;

@Dao
public interface BookMarkDao {

    @Insert
    void insert(BookMark bookMark);

    @Delete
    void delete(BookMark bookMark);

    @Update
    void update(BookMark bookMark);

    @Query("SELECT * FROM book_mark")
    LiveData<List<BookMark>> getAllBookMarks();

    @Query("SELECT * FROM book_mark " +
            "WHERE title LIKE '%' || :webTitle || '%'")
    LiveData<List<BookMark>> getBookMarksByTitle(String webTitle);
}
